package data.structure.linear.stack;

import data.structure.linear.List;
import data.structure.linear.arr.ArrayList;

/**
 * @Author douhy
 * @description 手写栈(动态数组实现)
 * @date 22/01/19
 */
public class Stack<E> {
    // 使用自实现集合
    private List<E> list = new ArrayList();

    private void clear(){
        list.clear();
    }

    private int size(){
        return list.size();
    }

    private boolean isEntity(){
        return list.isEmpty();
    }

    private void push(E e){
       list.add(e);
    }

    private E pop(){
       return list.remove(list.size() - 1);
    }

    private E peek(){
        return list.get(list.size() - 1);
    }

}
